// compile: g++ -o promise promise.cc -std=c++11
// run: ./promise
#include <chrono>
#include <future>
#include <iostream>
#include <thread>

using namespace std;
void Func(std::future<int>& fut) {
  cout << "thread1 go!" << endl;
  cout << fut.get() << endl;
  cout << "thread1 end!" << endl;
}
void Test1() {
  std::promise<int> pro;
  std::future<int> fut = pro.get_future();
  std::thread t1(Func, std::ref(fut));
  int a;
  cin >> a;
  pro.set_value(a);
  t1.join();
}
void Test2() {}
int main() {
  Test1();
  Test2();
  return 0;
}
